Spring boot 3 Keycloak integration for beginners | The complete Guide

Поделиться
HTML-код
  • Опубликовано: 8 июн 2024
  • #Keycloak #springboot3 #Java #WebSecurity #SSO #OpenIDConnect #OAuth2 #IAM #Tutorial #WebDevelopment
    Unlock the power of secure applications with this in-depth tutorial on integrating Keycloak, a robust open-source Identity and Access Management solution, with Spring Boot, one of the industry's leading Java application frameworks.
    🎁 Spring Data JPA course: aliboucoding.com/p/the-full-g...
    🎁 🚀 COUPON Code: EARLYBIRD20
    Source code: github.com/ali-bouali/keycloa...
    Don't Forget to
    ===========================================
    💯 Free courses here: aliboucoding.com/courses
    💯 Subscribe to the youtube channel
    💯 Join our Discord Community - / discord
    💯 Join our Facebook Group - / 589612651142975
    💯 Join our Instagram: / alibou_coding
    Whether you're building enterprise-grade applications or developing personal projects, effective identity and access management is critical. Keycloak, with its comprehensive set of features like Single Sign-On (SSO), Identity Brokering, User Federation, and Fine-Grained Authorization Services, provides a solid foundation for securing your applications.
    Boost your Spring Boot applications' security to the next level by mastering Keycloak integration. This tutorial is perfect for developers of all levels eager to enhance their understanding of application security.
    Make sure to hit the 'Subscribe' button for more tutorials and guides on Java, Spring Boot, Keycloak, and more. If you have any questions, please leave a comment below; we'd love to hear from you!
    Table of Content:
    00:00 Introduction
    01:07 Course curriculum
    02:35 Keycloak feature
    06:05 Keycloak advantages
    07:59 Keycloak terms
    11:24 Exploring the documentation
    14:37 Intall Keycloak
    16:56 Exploring & Playing with Keycloak
    33:56 Create new Spring boot project
    34:52 Create a demo controller
    36:09 Add security configuration
    39:04 Add OAuth2 configuration
    42:02 Test the chnages
    44:28 Add roles support
    49:26 JWT token converter
    01:09:44 Test and debug
    01:12:50 Outro

Комментарии • 331

  • @BoualiAli
    @BoualiAli  9 месяцев назад +3

    Join the Micro Services course waiting list and get and get an exclusive EARLY-BIRD discount
    aliboucoding.ck.page/d0f9317e13

  • @avialovers2508
    @avialovers2508 Год назад +1

    Thank you. I'm watching the second video on security in Spring boot on your channel and I'm absolutely delighted! No one has explained better yet.

    • @BoualiAli
      @BoualiAli  Год назад +1

      I’m super happy to know that. Happy to have you here

  • @elpanthouro6002
    @elpanthouro6002 10 месяцев назад +4

    Finally a tutorial that explains very well how keycloak works and its integration with springboot, thank you 🙏🏾

    • @BoualiAli
      @BoualiAli  10 месяцев назад

      Glad you liked it!

  • @BoualiAli
    @BoualiAli  10 месяцев назад

    COUPON Code: *EARLYBIRD20* => Spring Data J PA course: aliboucoding.com/p/the-full-guide-to-master-spring-boot-data-jpa

  • @user-di3gp7gb3w
    @user-di3gp7gb3w 8 месяцев назад

    안녕하세요
    알기 쉽고 꼼꼼하게 설명해주셔서 너무 감사합니다ㅜㅠ
    구독 할게요!

    • @BoualiAli
      @BoualiAli  8 месяцев назад

      Happy you liked it!

  • @vshlmlvliveit
    @vshlmlvliveit 5 месяцев назад +1

    Great video, it's really helpful that developers like you are putting hardcore efforts to share their knowledge.

  • @arefsa6
    @arefsa6 Год назад +12

    Dear alibou,
    I wanted to take a moment to say thank you for your amazing tutorial video on RUclips about Keycloak and its implementation in Spring Boot. Your video was incredibly helpful and easy to understand.
    I really appreciate how you explained the concepts of Keycloak and showed how it can be integrated with Spring Boot. Your explanations were clear and straightforward, making it easy for me to follow along.
    If possible, it would be great if you could create a video tutorial specifically focusing on the authentication flow. This would greatly enhance our understanding of the topic.
    Additionally, I would love to see a video tutorial on debugging in IntelliJ IDEA. As a beginner developer, learning effective debugging techniques is crucial, and I believe your guidance would be highly beneficial.
    Thank you once again for creating such valuable educational content. Your videos have significantly improved my understanding of Keycloak and Spring Boot, and I eagerly look forward to watching more of your tutorials in the future.
    Best regards,
    ArefSa

    • @BoualiAli
      @BoualiAli  Год назад +1

      I really appreciate this comment.

  • @mouradeljayi584
    @mouradeljayi584 Год назад +9

    The best spring boot teacher

  • @paulmoustakas6422
    @paulmoustakas6422 10 месяцев назад

    Really appreciate your video, amazing tutorial. Thank you!

    • @BoualiAli
      @BoualiAli  10 месяцев назад

      Glad you enjoyed it!

  • @vuongo9949
    @vuongo9949 Год назад +10

    I'm a Java fresher, and this time I want to work on a personal project involving Spring Security combined with JWT and OAuth2. I have watched many of your tutorial videos, and I must say they have been extremely helpful to me. Thank you for all the knowledge you have provided.

  • @vageeshanvageesh5583
    @vageeshanvageesh5583 Год назад

    Awaited one from you, thanks man, keep rocking 🎉❤❤

  • @faixan13
    @faixan13 8 месяцев назад

    Thanks for such great tutorial. It helps a lot to get basic understanding of keycloak

  • @arohawrami8132
    @arohawrami8132 Год назад

    Thanks a lot Ali. It was a great tutorial as usual.👏

  • @khalilbouali3480
    @khalilbouali3480 8 месяцев назад

    thanks a lot Ali! This was very informative !

    • @BoualiAli
      @BoualiAli  6 месяцев назад

      Glad it was helpful!

  • @juanpolo4617
    @juanpolo4617 Год назад

    Thanks a lot. your video is fantastic, everything was self-explanatory

  • @spalabutyi
    @spalabutyi Год назад +1

    Thanks, bro. This is probably the best video on the subject that I've come across recently. You're good at explaining things. I'd like to see another video on how to perform user registration through REST API and Keycloak.
    PS and, yeah, it would be great to watch a good video about OAuth and Spring Security REST API. I know you had something similar, but without the REST API."

    • @BoualiAli
      @BoualiAli  11 месяцев назад

      Glad you enjoyed it!
      I will provide such content ASAP

  • @janrubach3726
    @janrubach3726 3 месяца назад

    Great tutorial :D Thank You :D

  • @noelauras_nmr
    @noelauras_nmr Год назад +1

    Amazing video, perfectly explained, very educational.
    Thank you so much for this! (a video on debug mode on IntelliJ would be great).

  • @zakask6268
    @zakask6268 4 месяца назад

    thank you Ali for this amazing tutorial

  • @duongphuba7216
    @duongphuba7216 10 месяцев назад

    Thank you so much!! Your video is really helpful!!

    • @BoualiAli
      @BoualiAli  10 месяцев назад

      Glad it was helpful!

    • @duongphuba7216
      @duongphuba7216 10 месяцев назад

      @@BoualiAli Merci beaucoup! ;)

  • @enricomontesi6281
    @enricomontesi6281 2 месяца назад +1

    Thank you for the video. Your english is really understandable

    • @BoualiAli
      @BoualiAli  Месяц назад +1

      You're welcome 😊

  • @YGaming18
    @YGaming18 5 месяцев назад

    mr and so and so forth thank you

  • @sm2irfan
    @sm2irfan 9 месяцев назад

    Thanks a lot for your video, it is easy to understand the concept through your video

    • @BoualiAli
      @BoualiAli  8 месяцев назад

      Glad to hear that

  • @viniciusgallico5553
    @viniciusgallico5553 3 месяца назад

    excellent video, thank you for sharing!

    • @BoualiAli
      @BoualiAli  2 месяца назад

      Happy to have you

  • @rahulvaish3034
    @rahulvaish3034 10 месяцев назад

    I was going through a Udemy course, and the Keycloak screens there were too old, the new version of UI is very different. Thankfully I landed on this video. It helped me a lot. Thanks.

    • @BoualiAli
      @BoualiAli  10 месяцев назад

      Glad it was helpful!

  • @hojiakbarmadaminov2462
    @hojiakbarmadaminov2462 3 дня назад

    thank you!

  • @AdamKnebel
    @AdamKnebel 11 месяцев назад +1

    I finally watched a video that really helped me! Thank you for that! I would like to know how to make it possible to use Keycloak in both the back-end (Java + Spring) and the front-end with React.👏👏👏👏

    • @BoualiAli
      @BoualiAli  11 месяцев назад +1

      Happy you liked it!
      I’m working on it

  • @vm3f
    @vm3f Год назад

    Your explanation was amazing thanks

  • @walterzulu7263
    @walterzulu7263 Год назад

    great tutorial very elaborate and informative.

  • @corinemb1809
    @corinemb1809 Месяц назад

    Great. Thx a lot

  • @fkbey5756
    @fkbey5756 10 месяцев назад

    thanks for providing github repo.. it works like a charm

    • @BoualiAli
      @BoualiAli  10 месяцев назад +1

      Happy you liked it!

  • @ershadahamed8928
    @ershadahamed8928 День назад

    Those following this video, pls disable all the required actions in Configure -> Authentication -> Required actions tab. Applicable for keycloak 24.0.5.

  • @Riaru123
    @Riaru123 Год назад

    Thank you!!!

  • @gmgunesoglu
    @gmgunesoglu Месяц назад

    You are perfect bro!

  • @dunayqudretli3382
    @dunayqudretli3382 2 месяца назад +2

    Great tutorial👏

  • @siriusmarz512
    @siriusmarz512 Год назад

    Thank you so much

  • @prasadrandika7158
    @prasadrandika7158 3 месяца назад

    Hi..! since we are adding client roles as underlying role to realm roles do we need to add client roles again for the user?

  • @ahmedmk534
    @ahmedmk534 3 месяца назад

    thank you for the content. can you demonstrate how to automatically refresh the token once expired without having the user to login again (when microservice1 calls microservice2 for example) ?

  • @koi682
    @koi682 7 месяцев назад

    a lot of libraries were deprecated so it was difficult changing from sb2 to 3 but your tutorial helped a lot,thanks

    • @BoualiAli
      @BoualiAli  6 месяцев назад

      Happy you liked it!

  • @faakhy2954
    @faakhy2954 9 месяцев назад

    Thank you very much for this guide. The JWT Authentication converter is really tough but well explained! I'm looking for now to replicate / save keycloak users into my database.

    • @BoualiAli
      @BoualiAli  9 месяцев назад

      Why do you need to do that?

    • @remylavergne6424
      @remylavergne6424 9 месяцев назад

      @@BoualiAli Because I have some relations between entities like "UUID carOwner" into CarEntity (eg). And I add some business informations to my logged user. Do you think it's a bad practice?

    • @BoualiAli
      @BoualiAli  9 месяцев назад +1

      @@remylavergne6424 just save the user id from keycloak

  • @TobilobaOwolabi-wy8cq
    @TobilobaOwolabi-wy8cq 2 месяца назад

    Great video. How do we connect user signup and login to this so that KeyCloak can track it then

  • @alandercarraro218
    @alandercarraro218 2 месяца назад

    Amazing video Bouali. One question: How could I register new users in frontend with keycloak using Angular with springboot? in my frontend in a login form, first I check if the credencials is ok, if it is ok, I return the token for user be able to make request, is it right? Thanks

  • @alaminrony6881
    @alaminrony6881 Год назад

    The best spring boot teacher (Bouali Ali). I want to new video for Java Concurrency & Multithreading Complete Course

    • @BoualiAli
      @BoualiAli  Год назад +1

      Happy you liked it
      I will schedule such a video

  • @ChinhNguyen-eg5km
    @ChinhNguyen-eg5km 5 месяцев назад

    please make more video about keycloak, tks for your helpful video

  • @thavathrath
    @thavathrath 9 месяцев назад

    Thank you for the helpfull vdo. Please continue for user federation and store in db.
    Custom User Storage Provider

    • @BoualiAli
      @BoualiAli  9 месяцев назад

      Thank you, I will

  • @PeterNirschl
    @PeterNirschl 11 месяцев назад

    Danke!

    • @BoualiAli
      @BoualiAli  11 месяцев назад

      I really appreciate that ❤️❤️

  • @raphaellutz2693
    @raphaellutz2693 9 месяцев назад

    Nice tutorial, can you please go more into detail with keycloak so something like logout, double registration and so an. Amazing video!

    • @BoualiAli
      @BoualiAli  9 месяцев назад +1

      Happy you liked it!
      I will schedule one soon

  • @KhurramShahzad_PK
    @KhurramShahzad_PK 10 месяцев назад

    Thanks a lot for the helpful tutorial. Would be great if you can make a tutorial for KeyCloak integration with LDAP/Active Directory.

    • @BoualiAli
      @BoualiAli  10 месяцев назад

      Great suggestion!

  • @DashaZakella1001
    @DashaZakella1001 Год назад

    Thanks my friend for your lessons

    • @BoualiAli
      @BoualiAli  Год назад +1

      My pleasure 😇

    • @DashaZakella1001
      @DashaZakella1001 Год назад

      @@BoualiAli what about Spring Rest Data or maybe Spring Cloud?

    • @BoualiAli
      @BoualiAli  Год назад

      @@DashaZakella1001 what about them?

    • @DashaZakella1001
      @DashaZakella1001 Год назад

      @@BoualiAli can you make a video of them?

  • @user-jw2eo1gy6r
    @user-jw2eo1gy6r 3 месяца назад

    thank you bro for this video , but i had problmes regarding some deprecated versions of security , can u help me please ?
    thanks in advance

  • @saikumarmylavarapu8209
    @saikumarmylavarapu8209 18 дней назад

    If I create a role with "ROLE_user" as the role for the user then I don't have to worry about the 403 forbidden error and also I don't have to write the extra configuration for it ? to modify the roles from "user" to "ROLE_user" ?

  • @giovannientrago
    @giovannientrago 11 месяцев назад

    Hi, thanks for the video! I am wondering, can i use this guide for microservice architecture? If so, each microservice should have this spring security impl, or can i build my project in a different way, for example using security only for gateway and adding some general security to another microservices?

    • @BoualiAli
      @BoualiAli  11 месяцев назад +1

      It is enough to add security to API Gateway

  • @GianfrancoTerrazzano
    @GianfrancoTerrazzano 6 месяцев назад

    Hi Bouali, frist of all thank you for the video! I have to implement a similar project trough keycloak. I' using java 21 and spring boot 3.2.0, and I have to use a JWT bearer instead of a Bearer Token. Is it possibile? It's good idea using this application such base for trying to update my project?

  • @traian118
    @traian118 Год назад +2

    One interesting tutorial would be one for interacting with keycloak using it's API's. For example creating users, updating passwords etc...

    • @BoualiAli
      @BoualiAli  11 месяцев назад

      I will cover this part in a separate video

    • @traian118
      @traian118 11 месяцев назад

      @@BoualiAli this sounds great. Can’t wait to see that video 🙂

  • @khalifatwaha4212
    @khalifatwaha4212 4 дня назад

    @BoualiAli This is very good and well explained. But how to implement opaque token, is it even possible?

  • @lgiorgos1
    @lgiorgos1 6 месяцев назад

    Is there any point on assigning client_admin role when we have already assigned the realm admin role with is a composite role associated with the client_admin? Shouldn't it be included in the realm admin role

  • @codeexperience9998
    @codeexperience9998 5 дней назад

    Hey hi @boualiAli i have implemented the keyCloak integration with spring boot 3 but in case of invalid or expired token it is not throwing any exception can you please help me

  • @TheoMnc
    @TheoMnc 3 месяца назад

    Good video. 43:44 when i put the bear token it tells me also unauthorized ! anyone had the same problem ?

  • @alitorabi5717
    @alitorabi5717 7 месяцев назад

    👍👍👍👍👍thank you

    • @BoualiAli
      @BoualiAli  6 месяцев назад

      You are so welcome!

  • @KrishnaPatel-qu6nh
    @KrishnaPatel-qu6nh 11 месяцев назад

    thank you for this amazing tutorial.can you please make a video for implementation of multi tenancy with Keycloyk?

    • @BoualiAli
      @BoualiAli  11 месяцев назад

      Great suggestion!

  • @devozs
    @devozs Год назад +1

    Another great spring tutorial!
    Is it possible to combine this one together with spring social login?
    Thanks!

    • @BoualiAli
      @BoualiAli  Год назад +2

      Happy you liked it
      I will provide a video about that too

    • @devozs
      @devozs Год назад

      @@BoualiAli thanks 🙏

  • @reinaldojesus4002
    @reinaldojesus4002 9 месяцев назад +3

    With quarkus you don't need to write this bunch of classes and settings, just use a single @ROLES notation. Spring still has a lot to evolve compared to other frameworks. Actually what saved Spring was the Graal VM

    • @BoualiAli
      @BoualiAli  9 месяцев назад +4

      Spring is always 3 years (at least) ahead of the rest of the frameworks.
      For quarkus, I need to try it and the we can discuss

    • @amitkriit
      @amitkriit 3 месяца назад +1

      Spring is more mature and better documented.

    • @sadiulhakim7814
      @sadiulhakim7814 5 дней назад

      I would still go with spring because my company uses it.

  • @user-zr3dq1xb8o
    @user-zr3dq1xb8o Год назад +1

    I love your videos, this was really helpful to understand keycloak, but i would love to see if its possible to make a controller that gets the user credentials and with those credentials to make the request to the keycloak for the authentication if you have any tip on this it would be helful. Thanks again for the hard work !

    • @BoualiAli
      @BoualiAli  Год назад

      Happy you liked it.
      if you need such functionality, you just need to invoke the same endpoint I used in postman and pass the required body with the correct values and you will get the token

    • @user-zr3dq1xb8o
      @user-zr3dq1xb8o Год назад

      @@BoualiAli I tried that way and managed to make it work now i skipped the "/authentication" url so it can be accessed without Authorization header. And when i make a new request i pass the new token that i got from authentication to the request so Keycloak can make the check if the user is authenticated and has the right role to access the resources.
      Thanks again for help !

  • @rockenrohlfan
    @rockenrohlfan 10 месяцев назад

    Hi, thank you for the great video. I learned a lot and now I know how to build my web service safely. Thanks a lot for that! However, I still have one question: how do I get good tests written for it now? I follow the "test first" approach and of course my tests pop and don't work anymore. It doesn't work at all, because a token is missing to call the API. Can you say something about this, share a link or make a video?

    • @BoualiAli
      @BoualiAli  10 месяцев назад

      You can mock the security context.
      Please share more details on our discord server

  • @enishalilaj9309
    @enishalilaj9309 Год назад +1

    Hi there, great content! Just a quick question is it correct to say principle or principal? As I think we are referring to the request initiator which in this case would be a principal, but we refer to it as principle. Is this a typo or that's how it is supposed to be? Keep up the good work :)

    • @BoualiAli
      @BoualiAli  Год назад

      Can you please remind me which part of the video 😅

    • @enishalilaj9309
      @enishalilaj9309 Год назад

      @@BoualiAli For example the field principleAttribute, shouldn’t that be principalAttribute? I don’t get what are you referring to when you say principle? Just needed to clarify this :)

  • @gurudattahh3345
    @gurudattahh3345 9 месяцев назад +1

    Hey thanks for the tutorial, I am new to this so have a few questions..
    1. Instead of appending Role in code can't we just do it in keycloak itself.
    2. Can we use some kind of pattern matching like antmatcher and assign roles for endpoints instead of using preauthorize on each endpoint?.. it might become repetitive as endpoints increase to double digits.

    • @BoualiAli
      @BoualiAli  9 месяцев назад

      Happy you liked it!
      1- yes it is possible but you need to configure your spring app to remove the prefix (ROLE_)
      2- yes you can do that, check the roles and permissions video and you will have a clearer picture how to implement it

  • @abu-dukhan
    @abu-dukhan Год назад

    Thank you for this awesome content.
    Pls can you make a video for multiple implementation of UserDetaisService, so that the system can use multiple table for authenticating user depending on the Login endpoint. Thank you

    • @BoualiAli
      @BoualiAli  Год назад

      Happy you liked it
      The question that you really need to ask: why you have such system design?
      I guess you need to review you database design and group all the users in one table.
      Please provide more details and I will try to answer and assist you

  • @raphaellutz2693
    @raphaellutz2693 9 месяцев назад

    Hi, thanks for your video! I have a question about the flow of a real application. Does my frontend connect directly to Keycloak for authentication, or does it go through my backend, which then connects to Keycloak for authentication?

  • @michaelseptian9167
    @michaelseptian9167 9 месяцев назад

    Dear Alibou,
    I have question about JWT converter, how i can claim user attributes from user details in keycloak and i want use this claims for my controller or service? sorry for my grammar i still learning english. I hope you understand what i mean. Thank you Mr. Alibou great video

    • @BoualiAli
      @BoualiAli  9 месяцев назад

      Your english is good 👍.
      I already explained it in the token converter part

  • @justedlev
    @justedlev 8 месяцев назад

    Hello, great video tutorial, but could you explain how you can secure endpoints without using method level annotations? Thanks

    • @BoualiAli
      @BoualiAli  8 месяцев назад +1

      Check the Spring boot roles and pernmission video and you will have you answer there

  • @ravinaganaboyina8811
    @ravinaganaboyina8811 5 месяцев назад

    Hi, Great explanation
    Via spring boot security application need to add the user registration and authentication how to handle that?

  • @dhineshdhinesh6276
    @dhineshdhinesh6276 Год назад

    Thank you so much kindly put video about websocket chatbot spring boot thank you soooo much for you help

    • @BoualiAli
      @BoualiAli  Год назад +1

      Wow, I just finished recording this video.
      It will be published really soon

    • @dhineshdhinesh6276
      @dhineshdhinesh6276 Год назад

      Really thank you soo much sir you are great crystal clear explanation thank you so much sir

  • @maaryeem7085
    @maaryeem7085 9 месяцев назад

    Hi Ali, first of all I want to thank you for this very detailed and well-explained guide, it really helped me have a clearer idea on how keycloak integration works in spring boot,
    but I really want to ask for help on this minor problem,
    i'm still getting 403 forbidden when even after adding the role

    • @BoualiAli
      @BoualiAli  9 месяцев назад

      Please follow the steps precisely and assign the roles to the user

  • @Cherupakstmt
    @Cherupakstmt Год назад +1

    Nice video. But can you please make a video on how to log out user and change the session time using keycloak & spring security

    • @BoualiAli
      @BoualiAli  Год назад +1

      Happy you liked it
      I will create another video more detailed

    • @Cherupakstmt
      @Cherupakstmt Год назад

      @@BoualiAli Thanks. Eagerly waiting for it.

  • @DesasterUA
    @DesasterUA Год назад +2

    How would you forgo if you had to store additional user info that keycloak does not support like for example user preferred language?

    • @BoualiAli
      @BoualiAli  Год назад +2

      Happy you liked it
      I will create another video to show this details

    • @DesasterUA
      @DesasterUA Год назад

      @@BoualiAli that would be really helpful, thank you 😁

  • @zabialy2919
    @zabialy2919 Год назад

    This was really helpful!
    Is there a way to make the user manage his account (change username etc.) with some kind of rest api call?

    • @BoualiAli
      @BoualiAli  Год назад

      Happy you liked it
      Yes, you can use the keycloak endpoints to do that.
      I will try to make a video for that if you find it useful

    • @zabialy2919
      @zabialy2919 Год назад

      @@BoualiAli It would be really helpful as I couldn't find any guides on how to do that

  • @codingstyle9480
    @codingstyle9480 8 месяцев назад

    Hi, Thanks for the video. I would like to point out something about the role settings. Perhaps you need to make it a bit clearer that point. It seems we are defining users for the REALM. We can define Roles for a Realm as well. So any user that is defined under a particular realm can be associated with any role that is created within the same realm. For global permissions roles such as ADMIN, USER, MANAGER etc, may be handled by this realm role definition. Probably for fine-grain authorization within a client, we may need extra role definitions under a particular client such as USER(read but not write), ADMIN(data posting, updating etc).

    • @BoualiAli
      @BoualiAli  6 месяцев назад +1

      Sure, I will make that clear in the next video

  • @MortlMcCrisis
    @MortlMcCrisis 5 месяцев назад

    Thank you very much for this video. I was searching for a good tutorial for a long time, but most tutorials just throw some random code and config in your face, without any explanation. Mostly this does not really work and you have got no change to understand what you are doing and what is going wrong.
    This one is very different and I got a better understanding what is happening and I have got the feeling to start over by myself.

    • @BoualiAli
      @BoualiAli  5 месяцев назад

      Great to hear!

  • @iuliusciorica282
    @iuliusciorica282 Год назад +1

    Hello,
    Your tutorial is very good.
    Can you make a tutorial in which, in addition to Keycloak 21 and Spring Boot 3, Angular 16 is also integrated?
    There are few tutorials that integrate Keycloak, Spring Boot and Angular, and if there are, they are old because Keycloak has changed a lot in the meantime and many things are no longer the same.
    Thank you!

    • @BoualiAli
      @BoualiAli  Год назад +4

      Happy you liked it
      I'm working on a full angular video and it will be released soon.
      After that I will create another one for keycloak integration with Angular too

    • @iuliusciorica282
      @iuliusciorica282 Год назад +2

      @@BoualiAli Thank you!
      I am a fan of Angular and Spring Boot ❤

    • @DashaZakella1001
      @DashaZakella1001 Год назад +1

      @@BoualiAli i will wait that

    • @siriusmarz512
      @siriusmarz512 Год назад

      @@BoualiAli yes that is so awesome. Thank you.

  • @AbrahamPeter-nr3cq
    @AbrahamPeter-nr3cq Месяц назад

    Hello @BoualiAli thank you for taking your time to provide such detail tutorial on keycloak. I'm having issue logging in my user on postman. I've followed your steps but I keep getting this response:
    `{
    "error": "invalid_grant",
    "error_description": "Account is not fully set up"
    }` I'd like your advice on this. Thank you.

    • @BoualiAli
      @BoualiAli  Месяц назад

      Your realm and client are missing configuration.
      Please follow carefully

    • @AbrahamPeter-nr3cq
      @AbrahamPeter-nr3cq Месяц назад

      Please disregard this. Apparently, it is required that I provide the user email address and full name.

  • @user-pn9hw2bo9k
    @user-pn9hw2bo9k 3 месяца назад

    thank You Ali for This amazing tutorial ,can u do a vid about keycloak(24.0.1) authentifiaction(login//logout)with spring boot 3 thanks

  • @chrispure7461
    @chrispure7461 9 месяцев назад

    So, you don't need any keycloak dependencies in POM? Spring security is abstracting it? Also how to make rest api accept any of two tokens , one from keycloak and another one from diff auth server?

    • @BoualiAli
      @BoualiAli  9 месяцев назад

      Check the oauth2 video. This will help you understand the flow

  • @QuocNguyen-cf2dw
    @QuocNguyen-cf2dw Год назад

    I have a question. On your step cal to postman get token, I can see you don't have client_sercret, but the token still return. I follow you on my website, it return error:
    {
    "error": "unauthorized_client",
    "error_description": "Client secret not provided in request"
    }
    That mean I missing client_sercret, please elaborate it. Thanks so much

    • @BoualiAli
      @BoualiAli  Год назад

      for the tutorial, I created a public API so I didn't need a client secret

  • @denny3441
    @denny3441 7 месяцев назад

    How can we test this security configuration setup? Maybe you can do a tutorial on unit testing the security chain.

  • @rusifbudagov246
    @rusifbudagov246 10 месяцев назад

    Great tutorial. I would like to ask about Identity Brokering and Provider

    • @BoualiAli
      @BoualiAli  10 месяцев назад +1

      Happy you liked it!
      What about them?

    • @rusifbudagov246
      @rusifbudagov246 10 месяцев назад

      Thanks for replying . I need to implement custom Identity brokering in keycloack. Custom oidc. I can not find resources for thst

    • @BoualiAli
      @BoualiAli  10 месяцев назад +1

      @@rusifbudagov246 will try to schedule it

  • @leonschm
    @leonschm 2 месяца назад

    Congratulations, I wanted to use Keycloak to help me implement the project, I followed your steps and it's working, very good, now the question I have left is how I can validate the expiration of the jwt token, any ideas.

  • @Carloshdv
    @Carloshdv 3 дня назад

    How to create an user on keycloak with Java code ?

  • @user-jj6rv1lw1r
    @user-jj6rv1lw1r Год назад

    Hey Ali , Can you do a video about authentication flow of client

    • @BoualiAli
      @BoualiAli  Год назад

      Can you elaborate please?

  • @duongphuba7216
    @duongphuba7216 10 месяцев назад

    I've a question sir : I saw when you created spring project with needed dependencies, you chose Oauth2 Resource Server. Can you let me know when should we choose Oauth2 Authorization Server or Oauth2 Client ? Thank you so much!!

    • @BoualiAli
      @BoualiAli  10 месяцев назад +1

      -> Choose OAuth2 Authorization Server when you want to manage user authentication, issue access tokens, and handle authorization for your own resources.
      -> Choose OAuth2 Client when you need to access resources protected by an OAuth2 provider, such as social media APIs or third-party services.
      -> Choose OAuth2 Resource Server when you want to secure your own resources and validate incoming requests with OAuth2 access tokens, effectively acting as a protected resource server.
      => Authorization Server is for managing your own resources' security, OAuth2 Client is for accessing external resources, and OAuth2 Resource Server is for securing and protecting your own resources.

    • @duongphuba7216
      @duongphuba7216 10 месяцев назад

      @@BoualiAli Thank you so much for very clear answer. I appreciate it!

  • @wulfhound2859
    @wulfhound2859 11 месяцев назад

    I made a keycloak-spring-angular application using keycloak 18, I had to use the admin client to make the spring backend function as a middleware, because you can make a user in the keycloak window, but it would make a user by standard with the default-user profile, and you can assign a role to that group, but I had no idea how to differentiate between the users without using that middleware. Is there a way to do that? And using spring as middleware, makes it so you don't have to rewrite the custom keycloak registration page or start sending attributes with the jwt

    • @BoualiAli
      @BoualiAli  11 месяцев назад

      Can you please explain more. I really didn't get the issue

    • @wulfhound2859
      @wulfhound2859 11 месяцев назад

      @@BoualiAli so when making a user, using the default login page in keycloak, it automatically uses the default_group to register a user, à group to which you can assign the role Member for example, but I could not figure out how to give someone the role Mentor for example, because it defaults to default_group on the register page, that's why I had to use my Spring Backend as Middleware, making a rest call to the keycloak server and filtering through the realm roles to pick the right one, so my question is, can you differentiate between groups / users on the default keycloak registration page?

  • @dmitriizheleznikov2949
    @dmitriizheleznikov2949 6 месяцев назад +1

    Hi, thanks for the video! I have a question (maybe someone already found an answer): I tried to just create a new role ROLE_test_admin, and got 403, I guess it was because of principal, but why... What I'm trying to understand why we need to read "preferred_username" instead of "sub"?

    • @dmitriizheleznikov2949
      @dmitriizheleznikov2949 6 месяцев назад +1

      That's very strange, but the problem is not in principal "preferred_name" or "sub". "JwtAuthenticationConverter" simply doesn't get "resource_access....roles". It only checks
      Arrays.asList("scope", "scp");
      That's the reason... why...

    • @casimk5643
      @casimk5643 5 месяцев назад

      @@dmitriizheleznikov2949 try using hasRole rather than hasAuthority on the method.

  • @simplehumancomplexambition9884
    @simplehumancomplexambition9884 2 месяца назад

    Thanks for this awesome tutorial. However, I am following your steps but when trying to retrieve a token I keep getting
    "error": "invalid_grant", "error_description": "Account is not fully set up". I've been trying for 2 hours to figure it out but can't wrap my head around this. Any help is appreciated.

    • @BoualiAli
      @BoualiAli  Месяц назад +1

      you need to complete the user profile by providing all the required info: username, firstname, lastname, email

  • @simplemathematics7792
    @simplemathematics7792 11 месяцев назад

    I I put @Controller annotation and I am redirecting JSP pages according to the role based ,when I hit endpoint requests ,the access token generated is not being sent with the request how to do it,with postman it is working properly ,because we are giving request with the newly generated access token .what to do,how to do with browser help me

    • @BoualiAli
      @BoualiAli  11 месяцев назад

      You need to include the token in the header of the request

  • @souravpaul6086
    @souravpaul6086 Год назад +1

    well explained video ❤
    Could you please make a video where we are implementing social login and own jwt authentication in a single spring boot application.

    • @BoualiAli
      @BoualiAli  Год назад +1

      Happy you liked it
      I will make one soon

    • @souravpaul6086
      @souravpaul6086 Год назад

      @@BoualiAli Thank you
      and I also requested you to make a video where linkedin and twitter is act as a social media platform for oauth2 login instead of google and github with spring boot

    • @BoualiAli
      @BoualiAli  Год назад +1

      @@souravpaul6086 I’m preparing a video for that

    • @souravpaul6086
      @souravpaul6086 Год назад

      @@BoualiAli I am excited to learn that topic with your awesome explanation ❤️

  • @legendnic6339
    @legendnic6339 6 месяцев назад

    Hi Alibou, may I know if you planning to continue this tutorial, like authorization part and fine grain control on permission and stuff?

    • @BoualiAli
      @BoualiAli  6 месяцев назад

      Yes, I have it on my list

    • @legendnic6339
      @legendnic6339 6 месяцев назад

      ​@@BoualiAlii want to implement authorization for angular, but of course angular cannot set the authorization. it should be public access. but how to granularly define which path in angular, assosiiate with which permission in keycloak, and how to actually implement this?

  • @alexanderay2585
    @alexanderay2585 Год назад

    Hello, first of all, thanks for your ammazing content! I'm a total Beginner and i guess it's always worth to ask over here. In the SecurityConfig file i get a compiler error for csrf() saying csrf() is deprecated and marked for removal and the same for authorizeHttpRequests(), oauth2ResourceServer() and sessionManagement(). I followed exactly the same steps in the video, but didn't work for me. I would be relay grateful i i could get an answer over here.

    • @BoualiAli
      @BoualiAli  Год назад +1

      I assume you used spring 3.1
      Use spring 3.0 and you wont get issues.
      I will try to make a video covering the changes and how to fix it

    • @alexanderay2585
      @alexanderay2585 Год назад

      Thank you for your support! it fixed my issue

    • @BoualiAli
      @BoualiAli  Год назад

      @@alexanderay2585 can you share the details?

    • @alexanderay2585
      @alexanderay2585 Год назад

      I used version 3.1.0 when the errors occurred. However, when I started a new Spring Boot project using version 3.0.7, the compiler errors no longer occurred.

  • @bartosztoropolski8191
    @bartosztoropolski8191 Год назад

    Hey! I've got a question. You have spring + angle of course. Is this course in English? Since the description of all modules is in a different language (Spanish?)

    • @BoualiAli
      @BoualiAli  11 месяцев назад

      The course is in french.
      I'm working on adding subtitles (if this helps)

    • @bartosztoropolski8191
      @bartosztoropolski8191 11 месяцев назад

      @@BoualiAli When can we expect subtitles to be available? I would really like to buy this course

    • @BoualiAli
      @BoualiAli  11 месяцев назад

      @@bartosztoropolski8191 which language?

    • @bartosztoropolski8191
      @bartosztoropolski8191 11 месяцев назад

      @@BoualiAli english

    • @bartosztoropolski8191
      @bartosztoropolski8191 11 месяцев назад

      ​@@BoualiAli Hey, I have question Did you add english subtitles in your angular+spring course?

  • @danielopara_
    @danielopara_ 11 месяцев назад

    Great video but I have an error. Regarding jwt, I have a question. I have been following your instructions, but at the SecurityConfig phase, it tells that .jwt() has been deprecated. How do I approach this?

    • @BoualiAli
      @BoualiAli  11 месяцев назад

      I think you’re using 3.1
      Use 3.0 instead

    • @danielopara_
      @danielopara_ 11 месяцев назад

      @@BoualiAli it works , thank you

  • @manusoftar
    @manusoftar Месяц назад +1

    Now, the question is, how the heck you integrate it with the actual frontend??, I mean, I usually use SpringSecurity with JWT so what I do is I implement a service for the user to actually login which will return a minimal dataset about the user (like the name, the avatar, etc) and also the generated authentication Bearer token, so from ther on, the front end will have to attach that Bearer token to the header any time it wants to consume a service from my backend.
    Here I'm missing that last part, how does the frontend tell the backend it is authenticated?

    • @BoualiAli
      @BoualiAli  Месяц назад

      will be explained in the coming video

  • @saikumardasari4220
    @saikumardasari4220 8 месяцев назад

    Very nice explanation
    We need custom temple with keycloak for login and try to use front end as a react and back end is an springboot
    Note: When we are hitting front end that should be redirect to keycloak login custom template if user validated then we need to redirect to springboot and Response send to front end
    Thanks in advance

    • @BoualiAli
      @BoualiAli  8 месяцев назад

      Happy you liked it!
      I will cover more topics soon

    • @saikumardasari4220
      @saikumardasari4220 8 месяцев назад

      Thanks @@BoualiAli